package com.zeei.ems.base.config;

import cn.hutool.json.JSONUtil;
import com.zeei.ems.base.result.ResultBasicVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

/**
 * 全局异常
 */
@ControllerAdvice
@Slf4j
public class GlobalExceptionHandler {
    @ExceptionHandler(value =Exception.class)
    public String exceptionHandler(Exception e){
        log.error(">>>>发送异常: ",e);
        ResultBasicVO vo = new ResultBasicVO();
        vo.setMessage("服务异常，请联系系统管理员");
        vo.setResult(false);
        return JSONUtil.toJsonStr(vo);
    }

}
